import http from '@/http';
import type {AssignPam, LoginParm, QueryParams, UpdatePasswordParm, UserModel} from "@/api/user/UserModel";
import Login from "@/views/login/login.vue";


//新增用户
export const addApi = (data: UserModel) => {
    return http.post('/api/user', data);
};
//列表查询
export const getListApi = (params: QueryParams) => {
    return http.get('/api/user/getList', params);
};
//删除用户
export const deleteApi = (userId: string) => {
    return http.delete(`/api/user/${userId}`);
};

//根据用户id查询角色
export const getRoleListApi = (userId: string) => {
    return http.get('/api/user/getRoleList', {userId: userId})
}
//编辑
export const editApi = (parm: UserModel) => {
    return http.put('/api/user/', parm)
}
//重置密码
export const resetPassword = (data: { userId: string }) => {
    return http.post('/api/user/resetPassword', data);
};
//获取验证码
export const getVerifyCode = ()=>{
    return http.get('/api/user/getVerifyCode')
}
//登录
export const loginApi=(parm:LoginParm)=>{
    return http.post('/api/user/login',parm)
}
//查询菜单树
export const getAssignTreeApi=(parm:AssignPam)=>{
    return http.get('/api/user/getAssignTree',parm)
}
//修改Miami
export const updatePasswordApi = (parm:UpdatePasswordParm)=>{
    return http.post('/api/user/updatePassword',parm)
}
//获取用户信息
export const getUserInfoApi=(userId:string)=>{
    return http.get('/api/user/getUserInfo', {userId:userId})
}